package com.lizongbo.seotijian.rules;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.Writer;
import java.net.Socket;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.SimpleResolver;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;

import com.lizongbo.seotijian.rules.whois.WhoisClient;

/**
 * 
 * @see http://www.iana.org/domains/root/db/
 * @see http://pentan.info/php/sample/net_whois.html
 * @see http://photozero.net/zquery-tools/
 * @see http://www.iana.org/cgi-bin/whois?q=google.ad
 * @see http://blogoscoped.com/forum/21749.html
 * @see http 
 *      ://www.name.com/whois_result?type=domain&domain_name=618119.com&submit
 *      =+Submit+
 * @see http://linuxmafia.com/linux/network/domain-check-testdata *
 * @see https 
 *      ://launchpad.net/debian/sid/+source/whois/5.0.5/+files/whois_5.0.5.tar
 *      .gz!/whois-5.0.5/tld_serv_list linux 的whois命令程序源代码里有顶级域名的whois
 *      server对照表。
 * @see https://launchpad.net/debian/+source/whois 最新版程序是5.0.10
 * @author lizongbo
 * 
 */
public class DomainWhoisInfoCheckRule extends AbstractCheckRule {

	public DomainWhoisInfoCheckRule() {
		super();
		this.setMaxPoint(10);
	}

	@Override
	public boolean doCheck(URI uri) {
		if (uri == null) {
			return false;
		}
		String domainName = uri.getHost();

		return false;
	}

	public static void main(String[] args) throws IOException, Exception {
		DomainWhoisInfoCheckRule whoisInfoCheckRule = new DomainWhoisInfoCheckRule();
		String domain = "www.net.cn";// "618119.com";//
		// String nameServer = WhoisInfoCheckRule.getNameServer(domain);
		// System.out.println(WhoisInfoCheckRule.getWhoisInfo(domain));
		// System.out.println("domain whois server ====="
		// + WhoisInfoCheckRule.getWhoisServer(domain));
		// System.out.println(WhoisInfoCheckRule.getWhoisServer("google.com"));
		// System.out.println(WhoisInfoCheckRule.getWhoisInfo("180.com"));
		// System.out.println(DomainWhoisInfoCheckRule.getWhoisInfo("618119.com"));
		// System.out.println(DomainWhoisInfoCheckRule.getWhoisInfo("lizongbo.com"));
		// System.out.println(DomainWhoisInfoCheckRule.getWhoisInfo("hufuxinde.com"));
		// System.out.println(DomainWhoisInfoCheckRule.getWhoisInfo("mqq.im"));
		//		
		for (String[] tldwhois : WhoisClient.TLDS_WHOIS) {
			if (tldwhois[1].length() < 1) {
				System.out.println("who" + tldwhois[0]);
			}

		}
	}
}
